<!DOCTYPE html>
<html>


<!-- Mirrored from /theme/hplus/form_basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:15 GMT -->
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>乡土味士-后台管理中心 - 添加分类</title>
    <meta name="keywords" content="添加分类">
    <meta name="description" content="添加分类">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="__PUBLIC__/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__PUBLIC__/css/animate.min.css" rel="stylesheet">
    <link href="__PUBLIC__/css/style.min862f.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title" style="min-height: 65px;margin-bottom: 15px;">
                    <h5>
                        <a href="<?=U('Category/index')?>" title="分类列表">
                            <button type="button" class="btn btn-primary">分类列表</button>
                        </a>
                        <a href="<?=U('Category/addCate')?>" title="添加分类">
                            <button type="button" class="btn btn-primary">+添加分类</button>
                        </a>
                    </h5>
                </div>
                <div class="ibox-content">
                    <form method="post" class="form-horizontal" action="<?=U('Category/addCate')?>">
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" type="submit">保存内容</button>
                                <button class="btn btn-white" type="submit">取消</button>
                            </div>
                        </div>
                        <notempty  name="cateInfo.id">
                            <input type="hidden" name="id" value="<?=$cateInfo['id']?>">
                        </notempty >

                        <div class="form-group">
                            <label class="col-sm-2 control-label">分类名称</label>
                            <div class="col-sm-10">
                                <input type="text" name="title" class="form-control" value="<?=$cateInfo['title']?>" required>
                            </div>
                        </div>
                        <!--<div class="hr-line-dashed"></div>-->
                        <!--<div class="form-group">-->
                            <!--<label class="col-sm-2 control-label">已绑定关键词</label>-->
                            <!--<div class="col-sm-10">-->
                                <!--<textarea readonly="readonly" style="width: 100%;height: 50px;"><?=$cateInfo['keywords']?></textarea>-->
                            <!--</div>-->
                        <!--</div>-->
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">待绑定关键词</label>
                            <div class="col-sm-10" style="position: relative">
                                <input class="form-control" type="text" name="store_key1" placeholder="请输入关键词" style="width:300px;margin-bottom: 15px;">
                                <button type="button" class="btn btn-info btn-info1" onclick="searchKwords()" style="position: absolute;top: 0px;left: 300px;">
                                    搜索
                                </button>
                                <input type="checkbox" id="all"/>全选

                                <div class="store-select1">
                                    <!--<volist name="cate_keywords" id="vo">-->
                                        <!--<label class="checkbox-inline">-->
                                            <!--<input type="checkbox" value="{$vo.id}" id="inlineCheckbox{$vo.id}" name="keyid[]">{$vo.keyword}</label>-->
                                    <!--</volist>-->
                                </div>

                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">上级分类</label>
                            <div class="col-sm-10">
                                <select class="form-control m-b" name="pid">
                                    <option value="0">顶级分类</option>
                                    <volist name="cate_list" id="v">
                                        <option value="<?=$v['id']?>" <?=$v['id']==$cateInfo['id']?'disabled':''?><?=$v['id']==$cateInfo['pid']?'selected':''?>><?=$v['title']?></option>
                                            <notempty name="v['_child']">  <!--如果存在子集-->
                                            <volist name="v['_child']" id="val">
                                                <option value="<?=$val['id']?>" <?=$val['id']==$cateInfo['id']?'disabled':''?><?=$val['id']==$cateInfo['pid']?'selected':''?>>&nbsp;--<?=$val['title']?></option>
                                                    <notempty name="val['_child']">  <!--如果存在子集-->
                                                        <volist name="val['_child']" id="sval">
                                                            <option value="<?=$sval['id']?>" <?=$sval['id']==$cateInfo['id']?'disabled':''?><?=$sval['id']==$cateInfo['pid']?'selected':''?>>&nbsp;&nbsp;---<?=$sval['title']?></option>
                                                        </volist>
                                                    </notempty>

                                            </volist>
                                            </notempty>
                                    </volist>
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">排序</label>
                            <div class="col-sm-10">
                                <input type="text" name="sort" value="<?=$cateInfo['sort']?$cateInfo['sort']:'0'?>" required  class="form-control">
                                <span class="help-block m-b-none">默认为0</span>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">是否为导航</label>
                            <div class="col-sm-2">
                                <select class="form-control m-b" name="is_nav">
                                    <option>请选择该分类是否为导航</option>
                                    <option value="0" <?=$cateInfo['is_nav']==0?'selected':''?>>否</option>
                                    <option value="1" <?=$cateInfo['is_nav']==1?'selected':''?>>是</option>
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <!--<div class="form-group">-->
                            <!--<div class="col-sm-4 col-sm-offset-2">-->
                                <!--<button class="btn btn-primary" type="submit">保存内容</button>-->
                                <!--<button class="btn btn-white" type="submit">取消</button>-->
                            <!--</div>-->
                        <!--</div>-->
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="__PUBLIC__/js/jquery.min.js?v=2.1.4"></script>
<script src="__PUBLIC__/js/bootstrap.min.js?v=3.3.6"></script>
<script src="__PUBLIC__/js/content.min.js?v=1.0.0"></script>
<script src="__PUBLIC__/js/plugins/iCheck/icheck.min.js"></script>


<script src="__PUBLIC__/js/jquery.form.js"></script>
<script src="__PUBLIC__/js/layer/layer.js"></script>

<script>
    $(document).ready(function(){$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",})});

    // 全选，取消
    $('#all').on('click',function(){
        // alert(1);
        // var thias = $("input[name='keyid[]']");
        if(this.checked) {
            // alert(2);
            $("input[name='keyid[]']").attr('checked',true);
        }else {
            // alert(1);
            $("input[name='keyid[]']").attr('checked',false);
        }
    });


        //搜索关键词
    function searchKwords() {
        var store_key = $("input[name='store_key1']").val();
        $(".store-select1").empty();
        if(store_key){
            $.post('<?=U("Category/searchKwords")?>',{store_key:store_key},function(data){
                // console.log(data);
                if(data!=''){
                    //展示搜索结果
                    var instr = "";
                    for(var i=0;i<data.length;i++){
                        instr+='<label class="checkbox-inline"><input type="checkbox" value="'+data[i].id+'" id="inlineCheckbox'+data[i].id+'" name="keyid[]">'+data[i].keyword+'</label>';
                    }//end for
                }else{
                    var instr = "没有结果";
                }
                $(".store-select1").append(instr);
            });
        }else{
            layer.msg('请先输入关键词名称');
        }
    }


</script>

<script>
    //表单提交
    $(".js_form").ajaxForm({
        //定义返回JSON数据，还包括xml和script格式
        dataType: 'json',
        success: function(data) {
            //提交成功后调用
            if(data.status==1) {
                layer.msg(data.info, {icon:1,time:1000},
                    function(){
                        window.location.href= data.url;
                    });
            }else{
                layer.msg(data.info, {icon:2,time:1000});
            }
        }
    });
</script>


</body>


<!-- Mirrored from /theme/hplus/form_basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:15 GMT -->
</html>
